#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
#define int long long
#define ios ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define fi first
#define se second
#define endl "\n"
#define YES return cout << "YES" << endl, void()
#define NO return cout << "NO" << endl, void()
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
const double PI = acos(-1);
const double eqa = (1+sqrt(5.0))/2.0;
const int mod = 1000000007, inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
int dx[] = {0, 1, 0, -1, -1, 1, 1, -1};
int dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
int gcd(int x, int y) {return y ? gcd(y, x % y) : x;}
int qmi(int a, int k, int p){int res = 1;while (k){if (k & 1) res = (LL)res * a % p;a = (LL)a * a % p;k >>= 1;}return res;}
int read(){int x = 0, f = 1;char ch = getchar();while (ch < '0' || ch > '9'){if (ch == '-') f = -1; ch = getchar();}
while (ch >= '0' && ch <= '9'){x = x * 10 + ch - '0'; ch = getchar();}return x * f;}
const int N = 300010;
int n;
int a[N];
void solve()
{
cin >> n;
vector<int> res;
res.push_back(0);
map<int, int> mp;
for ( int i = 1; i <= n; i ++ ) {
int x;
cin >> x;
mp[x] ++;
if (mp[x] > 1) {
res.push_back(i);
mp.clear();
}
}
if (res.size() == 1) cout << -1 << endl;
else {
res[res.size() - 1] = n;
cout << res.size() - 1 << endl;
for ( int i = 1; i < res.size(); i ++ ) {
cout << res[i - 1] + 1 << " " << res[i] << endl;
}
}
}
signed main()
{
ios;
int t = 1;
// cin >> t;
while (t --)
{
solve();
}
return 0;
}
1151B - Dima and a Bad XOR | 1435B - A New Technique |
1633A - Div 7 | 268A - Games |
1062B - Math | 1294C - Product of Three Numbers |
749A - Bachgold Problem | 1486B - Eastern Exhibition |
1363A - Odd Selection | 131B - Opposites Attract |
490C - Hacking Cypher | 158B - Taxi |
41C - Email address | 1373D - Maximum Sum on Even Positions |
1574C - Slay the Dragon | 621A - Wet Shark and Odd and Even |
1395A - Boboniu Likes to Color Balls | 1637C - Andrew and Stones |
1334B - Middle Class | 260C - Balls and Boxes |
1554A - Cherry | 11B - Jumping Jack |
716A - Crazy Computer | 644A - Parliament of Berland |
1657C - Bracket Sequence Deletion | 1657B - XY Sequence |
1009A - Game Shopping | 1657A - Integer Moves |
230B - T-primes | 630A - Again Twenty Five |